﻿@model PageListClient<TopicClientModel>

@{
    ViewBag.Title = "Topic";
}

<div id="divPageTopic-j">
    <div data-bind="foreach: models">
        <ul class="nav-stacked">
            <li>
                <a data-bind='text: title, attr: { href: "/topic/show/"+id() }'></a>
                <div class="pull-right">
                    <a data-bind='attr: { href: "/topic/edit/"+id() }' ><i class="icon-pencil"></i>@LocaleResources["App.Edit"]</a>
                    <img data-bind='attr: {src: thumbnail}' />
                </div>
                <div data-bind="html: subTitle"></div>
            </li>
        </ul>
    </div>
    <div data-bind="pagination:'/api/user/topic'"></div>
</div>
@{
    ScriptRegister.AddJson("pageTopic", Model);
    ScriptRegister.AddKnockOutBinding("pageTopic", "#divPageTopic-j");
    Model.GenerateUniqueId();    
}
<script type="text/javascript">
    amplify.subscribe($ca.notification.pageIndexChanged + '@Model.UniqueId', function (event) {
        var url = event.url + '/' + event.pageIndex;
        pageTopic.basicTargetModelAjax(url, null, pageTopic, { type: 'GET' });
    });
</script>
